package ioperations;


import book.Book;
import book.BookList;

import java.util.Scanner;

public class AddOperation implements IOPeration{
    public void walk(BookList booklists){
        int chance=booklists.getUsedSize();
        int chance2=booklists.books.length;
        if(chance==chance2){
            System.out.println("书架已满，无法再放了！！！！");
            return;
        }
        Scanner scanner=new Scanner(System.in);

        System.out.println("请输入你要新增的书名：");

        String name=scanner.nextLine();


        System.out.println("请输入你要新增书的作者：");

        String auther=scanner.nextLine();


        System.out.println("请输入你要新增书的价格：");

        int price=scanner.nextInt();


        System.out.println("请输入你要新增书的类型：");

        String type=scanner.nextLine();


        Book book=new Book(name,auther,price,type);
        booklists.books[booklists.getUsedSize()]=book;
        booklists.setUsedSize(booklists.getUsedSize()+1);
        System.out.println("新增图书成功！！！");








    }
}
